<template>
  <div>
    <!-- 系统环境中是否安装杀毒软件检测 -->
    <div v-if="item.dId == '1411' && item.isDetection != '0'" class="divBox">
      <el-collapse-item class="my-collapse-item" :disabled="item.isPass == '1'">
        <template slot="title">
          <p style="width: 60%">检测项目: 系统环境中是否安装杀毒软件检测</p>
          <p>检测对象: 系统环境</p>
        </template>
        <div style="padding-left: 3%">
          检测操作系统是否安装国内通用杀毒软件<br>
          <el-radio-group @change="getRadio" v-model="radio" :disabled="item.isPass == '1'">
            <el-radio v-for="dict in dict.type.SDRJJC" :value="dict.value" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio>
          </el-radio-group>
        </div>
      </el-collapse-item>
    </div>

    <!-- 病毒感染检测 -->
    <div v-if="item.dId == '1412' && item.isDetection != '0'" class="divBox">
      <el-collapse-item class="my-collapse-item" :disabled="item.isPass == '1'">
        <template slot="title">
          <p style="width: 60%">检测项目: 病毒感染检测</p>
          <p>检测对象: 信息包</p>
        </template>
        <div style="padding-left: 3%;">
          <div v-if="phase == '0'||phase == '1'||phase == '4'">
            <el-radio @change="getRadio" v-model="radio" :label="'1'">调用国内通用杀毒软件接口，检测归档信息包是否感染病毒</el-radio>
          </div>
          <div v-if="phase == '1'">
            <el-radio @change="getRadio" v-model="radio" :label="'1'">调用国内通用杀毒软件接口，检测电子档案是否感染病毒</el-radio>
          </div>
          <div v-if="phase == '2'">
            <el-radio @change="getRadio" v-model="radio" :label="'1'">调用国内通用杀毒软件接口，检测电子档案是否感染病毒</el-radio>
          </div>
        </div>
      </el-collapse-item>
    </div>

    <!-- 载体中多余文件检测 -->
    <div v-if="item.dId == '1421' && item.isDetection != '0'" class="divBox">
      <el-collapse-item class="my-collapse-item" :disabled="item.isPass == '1'">
        <template slot="title">
          <p style="width: 60%">检测项目: 载体中多余文件检测</p>
          <p>检测对象: 内容数据</p>
        </template>
        <div style="padding-left: 3%;">
          <div v-if="phase == '0'||phase == '4'">
            <el-radio @change="getRadio" v-model="radio" :label="'1'">对载体进行读取操作,判断载体内是否含有非归档文件</el-radio>
          </div>
          <div v-if="phase == '1'">
            <el-radio @change="getRadio" v-model="radio" :label="'1'">对载体进行读取操作,判断载体内是否含有非移交文件</el-radio>
          </div>
        </div>
      </el-collapse-item>
    </div>

    <!-- 载体读取速度检测（人工检测） -->
    <div v-if="item.dId == '1422' && item.isDetection != '0'" class="divBox">
      <el-collapse-item class="my-collapse-item" :disabled="item.isPass == '1'">
        <template slot="title">
          <p style="width: 60%">检测项目: 载体读取速度检测（人工检测）</p>
          <p>检测对象: 载体</p>
        </template>
        <el-radio @change="getRadio" v-model="radio" :label="'1'">默认通过，人工判断对载体进行读取操作,和常规的读取速度进行比对判断载体是否安全可靠</el-radio>
      </el-collapse-item>
    </div>

    <!-- 载体外观检测（人工检测） -->
    <div v-if="item.dId == '1423' && item.isDetection != '0'" class="divBox">
      <el-collapse-item class="my-collapse-item" :disabled="item.isPass == '1'">
        <template slot="title">
          <p style="width: 60%">检测项目: 载体外观检测（人工检测）</p>
          <p>检测对象: 载体</p>
        </template>
        <el-radio @change="getRadio" v-model="radio" :label="'1'">默认通过，人工判断载体外观是否正常</el-radio>
      </el-collapse-item>
    </div>

    <!-- 光盘合格性检测 -->
    <div v-if="item.dId == '1424' && item.isDetection != '0'" class="divBox">
      <el-collapse-item class="my-collapse-item" :disabled="item.isPass == '1'">
        <template slot="title">
          <p style="width: 60%">检测项目: 光盘合格性检测</p>
          <p>检测对象: 归档光盘</p>
        </template>
        <div style="padding-left: 3%;">
          <el-radio @change="getRadio" v-model="radio" :label="'1'">依据DA/T 38的要求对光盘的奇偶校验内码错误(PIE)、奇偶校验外码失败(POF)、块错误率(BLER)等指标进行检测，判断光盘是否合格</el-radio>
        </div>
      </el-collapse-item>
    </div>

    <!-- 操作过程安全性检测 -->
    <div v-if="item.dId == '1431' && item.isDetection != '0'" class="divBox">
      <el-collapse-item class="my-collapse-item" :disabled="item.isPass == '1'">
        <template slot="title">
          <p style="width: 60%">检测项目: 操作过程安全性检测</p>
          <p>检测对象: 系统环境</p>
        </template>
        <div style="padding-left: 3%;">
          <div v-if="phase == '0'||phase == '4'">
            <el-radio @change="getRadio" v-model="radio" :label="'1'">按照国家安全保密要求从技术和管理等方面采取措施,确保归档信息包在归档和保存过程中安全、可控</el-radio>
          </div>
          <div v-if="phase == '1'">
            <el-radio @change="getRadio" v-model="radio" :label="'1'">按照国家安全保密要求从技术和管理等方面采取措施,确保移交信息包在移交和接收过程中安全、可控</el-radio>
          </div>
        </div>
      </el-collapse-item>
    </div>

    <!-- 软件系统安全漏洞检测 -->
    <div v-if="item.dId == '1441' && item.isDetection != '0'" class="divBox">
      <el-collapse-item class="my-collapse-item" :disabled="item.isPass == '1'">
        <template slot="title">
          <p style="width: 60%">检测项目: 软件系统安全漏洞检测</p>
          <p>检测对象: 系统环境</p>
        </template>
        <div style="padding-left: 3%;">
          <el-radio @change="getRadio" v-model="radio" :label="'1'">采用专业的漏洞扫描工具检测参与电子档案长期保存的计算机系统是否存在安全漏洞</el-radio>
        </div>
      </el-collapse-item>
    </div>

    <!-- 载体保管环境安全检测（人工检测） -->
    <div v-if="item.dId == '1451' && item.isDetection != '0'" class="divBox">
      <el-collapse-item class="my-collapse-item" :disabled="item.isPass == '1'">
        <template slot="title">
          <p style="width: 60%">检测项目: 载体保管环境安全检测（人工检测）</p>
          <p>检测对象: 保管环境</p>
        </template>
        <el-radio @change="getRadio" v-model="radio" :label="'1'">默认通过，对照国家有关规定,人工判断磁盘、磁带、光盘等各类载体的保管环境是否符合要求</el-radio>
      </el-collapse-item>
    </div>


  </div>
</template>

<script>

export default {
  name: "security",
  props: ["item", "phase", "detail"],
  archive_Dicts: ['SDRJJC'],
  data() {
    return {
      selected:[],
      params: {},
      radio: '',
      dataInfo: undefined
    }
  },
  watch: {
    item: {
      handler(val) {
        this.dataInfo = JSON.parse(JSON.stringify(val))
        this.getDataInfo()
      },
      immediate: true,
      deep: true
    },
  },
  methods: {
    // 单选框
    getRadio() {
      if(this.item.isPass == 0 && this.item.isDetection == 1) {
        let params = JSON.parse(JSON.stringify(this.params))
        params.dId = this.item.dId
        params.isDetection = this.item.isDetection
        params.isPass = this.item.isPass
        params.detectionItemList = []
        var obj = {}
        obj.name = this.radio
        obj.style = 'radio' // 单选框
        setTimeout(() => {
          params.detectionItemList.push(obj)
        }, 0)
        this.$nextTick(() => {
          this.changeTap(params)
          this.params = JSON.parse(JSON.stringify(params))
        })
      }
    },
    // 回显数据
    getDataInfo() {
      if (this.dataInfo.detectionItemList != null) {
        if (this.dataInfo.detectionItemList.length != 0) {
          for (let i = 0; i < this.dataInfo.detectionItemList.length; i++) {
            if (this.dataInfo.detectionItemList[i].style == 'radio') {
              this.$set(this, 'radio', this.dataInfo.detectionItemList[i].name);
            }
          }
        }
      }
    },
    onChangeTap(item) {
      if(item.isdId == false) {
        this.selected = []
      }
    },
    changeTap(item) {
      this.$emit('ChangeTap', item)
    },
  }
}
</script>

<style lang="scss" scoped>
.my-collapse-item::after {
  content: "";
  display: block;
  border-bottom: 1px solid #ebeef5; /* 下边界线样式 */
}
.my-collapse-item {
  width: 100%;
}

.divBox {
  display: flex;
}

.checkBox {
  flex-basis: 30%;
  margin-bottom: 1%;
  .el-checkbox {
    width: 30%;
  }
}
</style>
